package mysql

import "gorm.io/gorm"

type Patient struct {
	gorm.Model
	Name    string `gorm:"type:varchar(30)"`
	CarNum  string `gorm:"type:varchar(30)"`
	Phone   string `gorm:"type:varchar(11)"`
	Address string `gorm:"type:varchar(100)"`
}

func (p *Patient) PatientAdd(db *gorm.DB) error {
	return db.Debug().Create(p).Error
}

func (p *Patient) PatientShowById(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).First(p).Error
}

func (p *Patient) PatientDel(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).Delete(p).Error
}
